odoo.define('customer.button_bounce', function (require) {
    "use strict";
    var core = require('web.core');
    var ListView = require('web.ListView');
    var ListController = require('web.ListController');

    ListController.include({
        _get_notice: function (ev) {
            var actionMenus = ev.data.controlPanelProps.actionMenus
            var activeIds = actionMenus?actionMenus.activeIds:false
            var res_model = ev.data.controlPanelProps.action.res_model
            var resname = '自定义模型'
            var view_type = 'tree'
            var self = this

            if (actionMenus && activeIds) {
                var result = ev.data._rpc({
                    model: res_model,
                    method: 'rpc_method',
                    args: [activeIds, ],
                }).then(function (data) {
                    console.log(data)
                })
            // self.do_action({
            //         type: 'ir.actions.act_window',
            //         name: resname,
            //         res_model: res_model,
            //         views: [[false, 'tree']],
            //         target: 'new',
            //         context: {
            //             view_type: view_type,
            //             active_ids: activeIds,
            //         },
            //     })
        } else {
            alert('没有选择明细')
}

},
    renderButtons: function () {
        var result = this._super.apply(this, arguments);
        if (this.$buttons) {
            var self = this
            // this.$buttons.find('.o_list_tender_button_bounce').click(function () {
            //     var view_type = self.viewType;
            //     var actived_id;
            //     if (view_type == "list") {
            //         actived_id = self.controlPanelProps.actionMenus.active_Ids;
            //         console.log(actived_id);
            //         // 至此你获取到了 当前form 的ID，你可以在JS里拿这着这个ID搞点事
            //         // 当然，你也可以去调用后台的方法,或者打开一个新的页面，一个新的wizard
            //     }
            //
            // })
            this.$buttons.find('.o_list_tender_button_bounce').click(self, this._get_notice)
        }
        return result;
    }
});
})
;